﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
namespace _22_JWT封装.Models
{

    // 解决 add-migration 命令 出现的错误：
    // 错误红色底色的内容是Unable to create an object of type 'MyDbContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
    public class DbContextDesignTimeFactory : IDesignTimeDbContextFactory<MyDbContext>
    {
        public MyDbContext CreateDbContext(string[] args)
        {
            DbContextOptionsBuilder<MyDbContext> builder1 = new DbContextOptionsBuilder<MyDbContext>();
            builder1.UseSqlServer("Data Source=.;database=coreIdentity;Integrated Security=sspi;");
            return new MyDbContext(builder1.Options);
        }
    }
}
